package com.investmenttechnologyservices.services;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.users.User;

public interface LoginService {
	UserInfo getUserInfo(HttpServletRequest req, HttpServletResponse res);
	Key getFirmKeyForCurrentUser();
	
	public static class UserInfo {
		private User user;
		private String loginURL;
		private String logoutURL;
		public UserInfo() {
		}
		public UserInfo(User user, String loginURL, String logoutURL) {
			this.user = user;
			this.loginURL = loginURL;
			this.logoutURL = logoutURL;
		}
		public String getLoginURL() {
			return loginURL;
		}
		public void setLoginURL(String loginURL) {
			this.loginURL = loginURL;
		}
		public String getLogoutURL() {
			return logoutURL;
		}
		public void setLogoutURL(String logoutURL) {
			this.logoutURL = logoutURL;
		}
		public String getAuthDomain() {
			if (user == null) {
				return null;
			}
			return user.getAuthDomain();
		}
		public String getEmail() {
			if (user == null) {
				return null;
			}
			return user.getEmail();
		}
		public String getFederatedIdentity() {
			if (user == null) {
				return null;
			}
			return user.getFederatedIdentity();
		}
		public String getNickname() {
			if (user == null) {
				return null;
			}
			return user.getNickname();
		}
		public String getUserId() {
			if (user == null) {
				return null;
			}
			return user.getUserId();
		}
	}

}
